package com.k7.mobile.platform.bo.impl;

import java.util.List;

import com.k7.mobile.platform.bo.ITypeBO;
import com.k7.mobile.platform.dao.ITypeDAO;
import com.k7.mobile.platform.dataobject.TypeDO;
import com.k7.mobile.platform.exception.BOException;

public class TypeBOImpl extends BaseBOImpl implements ITypeBO{
	
	private ITypeDAO typeDAO;

	public void setTypeDAO(ITypeDAO typeDAO) {
		this.typeDAO = typeDAO;
	}

	public Long add(TypeDO typeDO) throws BOException {
		try{ 
			Long id=typeDAO.add(typeDO);
			return id;
		}catch(Exception ex){
			log.error("TypeBOImpl:add,插入Type失败", ex);
			throw new BOException("创建禁止Type失败", ex);
		}
	}

	@Override
	public void delete(TypeDO typeDO) throws BOException {
		try{
			typeDAO.delete(typeDO);
		}catch(Exception ex){
			log.error("TypeBOImpl:delete,删除Type失败", ex);
			throw new BOException("删除Type失败", ex);
		}
		
	}
	@Override
	public void update(TypeDO typeDO) throws BOException {
		try{
			typeDAO.update(typeDO);
		}catch(Exception ex){
			log.error("TypeBOImpl:delete,更新Type失败", ex);
			throw new BOException("更新Type失败", ex);
		}
		
	}

	@Override
	public List<TypeDO> findList(TypeDO typeDO) throws BOException {
		try{

			List<TypeDO> list = typeDAO.findList(typeDO);
			return list;
		}catch(Exception ex){
			log.error("TypeBOImpl:findList,批量获取Type信息出错", ex);
			throw new BOException("批量获取Type信息出错", ex);
		}
		
	}
	

	@Override
	public TypeDO getType(TypeDO typeDO) throws BOException {
		try{

			TypeDO returnDO = typeDAO.getType(typeDO);

			return returnDO;
		}catch(Exception ex){
			log.error("TypeBOImpl:getType,获取Type信息出错", ex);
			throw new BOException("获取Type信息出错", ex);
		}
	}
	
	
}
